<!DOCTYPE html>
<html>
<include file="Public:header" />


<body>

<script type="text/javascript">
    $(function () {

        $(".datepicker-start").datepicker({
            dateFormat: 'yy-mm-dd',
            showButtonPanel: true,

        });




    })

    actionStr="{:U('ivr/channelByPrivence')}"
    function privence_info(p) {
        console.log(p);
        var form = $("#form1");
        var form=form.serialize();

        $.ajax({
            url: actionStr,
            type: 'GET',
            data: form+"&privence="+p,
            dataType: '',
            contentType: "application/json; charset=utf-8",
            success:function(data){
                console.log(data);
                for( var i = 0; i < data.length; i++ ) {
                    //动态创建一个tr行标签,并且转换成jQuery对象
                    var $trTemp = $("<tr></tr>");

                    //往行里面追加 td单元格
                    $trTemp.append("<td>"+ data[i].channel +"</td>");
                    $trTemp.append("<td>"+ data[i].jifei_count +"</td>");

                    // $("#J_TbData").append($trTemp);
                    $trTemp.appendTo("#J_TbData");
                }
                $('#dlg').modal({
                    keyboard: true
                });
            },
            error: function (xhr, error, exception) {

                alert(exception);

            }
        });
    }


</script>

<form action="{:U('small/statByPrivence_')}" method="post" id="form1">
    开始:<input class="datepicker-start" type="text" name="pdate_start" value="{$pdate_start}"/>
    结束:<input class="datepicker-start" type="text" name="pdate_end" value="{$pdate_end}"/><br/>
    渠道:
    <select name="pchannel">
        <option value="0">所有</option>
        <foreach name="channels" item="vo">
            <eq name="vo.key" value="$pchannel">
                <option value="{$vo['key']}"  selected>{$vo['key']}</option>
                <else/>
                <option value="{$vo['key']}"  >{$vo['key']}</option>
            </eq>

        </foreach>
    </select>
    <input type="submit" value="统计" class="btn btn-default">


</form>

<!-- 模态框（Modal） -->
<div class="modal fade" id="dlg" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">{$vo.channel}</h4>
            </div>
            <div class="modal-body">

                <table class="table table-bordered table-hover definewidth m10">
                    <thead>
                    <tr>
                        <th>渠道</th>
                        <th>计费数量</th>

                    </tr>
                    </thead>
                    <tbody id="J_TbData">
                    </tbody>
                </table>

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>

            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
<table class="table table-bordered table-hover definewidth m10">
    <thead>

    <tr>

        <th>省份</th>

        <th>成功数</th>


    </tr>
    </thead>
    <tbody>

    <foreach name="data" item="vo">
        <tr >
            <td onclick="privence_info($(this).text())">{$vo.dcprivence}</td>



            <td>{$vo.count}</td>


        </tr>

    </foreach>

    </div>
    </tbody>
</table>


</body>

</html>